string function Scan

Scan(String, Format) function returns a string as extracted from string String and according to string format Format. The format is built with the same rules sscanf uses. See man pages on scanf(3). Note that the format must contain one active "%s" or "%[]" construction. An example might be of some help here, especially to show how to use Scan in conjunction with C-calculator mode defined strings. Scan is particularly helpful to extract parts of filenames. Recall that strings are defined by double quotes as in standard C.

Knowing about the "%[ ]" scanf(3) construction might be useful at this point. Consider the following few examples: "%[a-zA-Z]" means to read the longest string matched so that it is composed of any letter; "%[ˆ 0-9]" means to read the longest string matched so that it is NOT composed of any digit; "%[ˆ _.]" means to read the longest string matched so that it is not composed of characters `_' or `.'.

     # define a string called Testname
     let Testname = "dummy25.dat"
     # Read until a point is encountered
     let Base = Scan(Testname, "%[^.]"))

$, scan, string functions Read, DirName, FileName, C, cmode, quotes